package com.qf.lja.enity;

import java.util.Date;

public class Cart {
    private Integer shopId;
    /**
     * 商品ID
     */
    private Integer productId;
    private Product product;   //关联实体

    public Cart() {
    }

    public Cart(int productId, Integer userId, int i1, Double i3) {
        this.userId = userId;
        this.productId = productId;
        this.productQuantity = i1;
        this.totalPrice = i3;
    }

    public Product getProduct() {
        return product;
    }

    public void setProduct(Product product) {
        this.product = product;
    }

    /**
     * 用户ID
     */
    private Integer userId;
    /**
     * 商品数量
     */
    private Integer productQuantity;
    /**
     * 总金额
     */
    private Double totalPrice;
    /**
     * 购物车状态
     */
    /**
     * 创建时间
     */
    private Date createdTime;
    /**
     * 更新时间
     */
    private Date updatedTime;

    public Integer getShopId() {
        return shopId;
    }

    public void setShopId(Integer shopId) {
        this.shopId = shopId;
    }

    @Override
    public String toString() {
        return "Cart{" +
                "shopId=" + shopId +
                ", productId=" + productId +
                ", userId=" + userId +
                ", productQuantity=" + productQuantity +
                ", totalPrice=" + totalPrice +
                ", createdTime=" + createdTime +
                ", updatedTime=" + updatedTime +
                '}';
    }

    public Integer getProductId() {
        return productId;
    }

    public void setProductId(Integer productId) {
        this.productId = productId;
    }

    public Integer getUserId() {
        return userId;
    }

    public void setUserId(Integer userId) {
        this.userId = userId;
    }

    public Integer getProductQuantity() {
        return productQuantity;
    }

    public void setProductQuantity(Integer productQuantity) {
        this.productQuantity = productQuantity;
    }

    public Double getTotalPrice() {
        //计算返回
        return productQuantity * product.getPrice();
    }

    public void setTotalPrice(Double totalPrice) {
        this.totalPrice = totalPrice;
    }

    public Date getCreatedTime() {
        return createdTime;
    }

    public void setCreatedTime(Date createdTime) {
        this.createdTime = createdTime;
    }

    public Date getUpdatedTime() {
        return updatedTime;
    }

    public void setUpdatedTime(Date updatedTime) {
        this.updatedTime = updatedTime;
    }


}
